import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from PIL import Image

img = mpimg.imread('img/stinkbug.png')
print(img)

plt.imshow(img)
plt.colorbar()
plt.show()

plt.imshow(img, cmap="hot")
plt.colorbar()
plt.show()

plt.imshow(img).set_cmap('nipy_spectral')
plt.colorbar()
plt.show()

plt.hist(img.ravel(), bins=256, range=(0.0, 1.0), fc='k', ec='k')
plt.show()

fig = plt.figure()
ax = fig.add_subplot(1, 2, 1)
plt.imshow(img)
ax.set_title('Before')
plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal')
ax = fig.add_subplot(1, 2, 2)
plt.imshow(img).set_clim(0.0, 0.7)
ax.set_title('After')
plt.colorbar(ticks=[0.1, 0.3, 0.5, 0.7], orientation='horizontal')

img = Image.open('img/stinkbug.png')
img.thumbnail((64, 64))  # resizes Image in-place
plt.imshow(img)
plt.show()

plt.imshow(img, interpolation="nearest")
plt.show()

plt.imshow(img, interpolation="bicubic")
plt.show()